﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DailyRssDownload.Lib {
	[Serializable]
	public class ContentSource {
		public enum ContentSourcesEnum {
			None,
			Summary,
			Download
		}

		public ContentSourcesEnum ContentSourceValue { get; set; }
		public string ContentSourceDescription {
			get {
				switch (ContentSourceValue) {
					case ContentSourcesEnum.None:
						return "No content, summary only";
					case ContentSourcesEnum.Summary:
						return "Use the RSS description field";
					case ContentSourcesEnum.Download:
						return "Download from the referenced web page";
					default:
						throw new DailyRssDownloadException("Unknown Content Source: " + ContentSourceValue);
				}
			}
		}

		public ContentSource() {
		}

		public ContentSource(ContentSourcesEnum objSourceEnum) {
			this.ContentSourceValue = objSourceEnum;
		}

		public static IList<ContentSource> GetAllContentSources() {
			IList<ContentSource> lstAllSources = new List<ContentSource>();

			lstAllSources.Add(new ContentSource(ContentSourcesEnum.None));
			lstAllSources.Add(new ContentSource(ContentSourcesEnum.Summary));
			lstAllSources.Add(new ContentSource(ContentSourcesEnum.Download));

			return lstAllSources;
		}

		public override string ToString() {
			return ContentSourceDescription;
		}
	}
}
